package com.yiqi.lottery.feature.mine.model;

import com.luck.picture.lib.rxbus2.RxBus;
import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.PageData;
import com.yiqi.lottery.entity.bo.CharsBo;
import com.yiqi.lottery.entity.bo.OrderListBo;
import com.yiqi.lottery.feature.lottery.dependencies.order.DaggerOrderModelComponent;
import com.yiqi.lottery.feature.mine.contract.NumberContract;
import com.yiqi.lottery.feature.mine.contract.OrderContract;
import com.yiqi.lottery.feature.mine.dependencies.number.DaggerNumberModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.UserApi;
import io.reactivex.Observable;

import javax.inject.Inject;

public class NumberModel implements NumberContract.Model {

    @Inject
    UserApi api;


    @Inject
    public NumberModel() {

        DaggerNumberModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<PageData<CharsBo>> getMyCharsList(int page) {
        return api.getCharsingList(page).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<CharsBo> getMyCharsDetail(int id) {
        return api.getCharsingdEATIL(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
